
<div>

<% @test.parts.each do |p| %>

  <%= p.name %><br/>
  <% i = 0 %>
  <% p.questions.each do |q| %>
    <% i += 1 %>
    第<%= i %>题.
    <!--
    <%= q.description %> &nbsp;&nbsp;
    维度：<%= q.dimen.name if q.dimen %>
    <br/>
    -->

  <% end  %><br/>
<% end %> 
    <hr/>
<% @test.dimens.each do |d| %>

  维度：<%= d.name %>包含题目：<br/>
  <% i = 0 %>
  <% d.questions.each do |q| %>
    <% i += 1 %>
    第<%= i %>题.
    
  <% end  %><br/>
<% end %> 
</div>
<hr/>
<div>

  <% def select_method(form, column, type)
       form.select(column,
          CountMethod.all(:conditions => {:method_type => type}).collect {|m| [ m.zh, m.id ] },
          { :include_blank => false })
     end
  %>
  <%= flash[:notice] %>
  <% form_for(@survey_count_method, :url => { :action => "create_survey_count_method" }) do |f| %>
    <input type="hidden" name="test_id" value="<%= @test.id %>"/>
  <div>
    总分计算方法：
    <%= select_method(f, "total", "total")%>
    加权分值：
    <input type="text" name="survey_count_method[add_num]" value="<%=0 or @test.survey_count_method.add_num%>" size="5"/>
    <!--%= in_place_editor_field "survey_count_method", "add_num", {}, {
      :load_text_url => url_for(:action => "get_survey_count_method_add_num", :id => @test)
    }%-->
    <br/><br/>
  </div>
  <div>
    均分计算方法：
    <%= select_method(f, "avg", "avg")%>
   
    加权分值：
    <input type="text" name="survey_count_method[add_num]" value="<%=0 or @test.survey_count_method.add_num%>" size="5"/>
    <br/><br/>
  </div>
  <div>
    子量表总分计算方法：
    <%= select_method(f, "children_total", "total")%>
    加权分值：
    <input type="text" name="" value="<%=0 or @test.survey_count_method.add_num%>" size="5"/>
    <br/><br/>
  </div>
  <div>
    子量表均分计算方法：
    <%= select_method(f, "children_avg", "avg")%>
    加权分值：
    <input type="text" name="" value="<%=0 or @test.survey_count_method.add_num%>" size="5"/>
    <br/><br/>
  </div>
  <div>
    维度总分计算方法：
    <%= select_method(f, "dimen_total", "total")%>
    加权分值：
    <input type="text" name="" value="<%=0 or @test.survey_count_method.add_num%>" size="5"/>
    <br/><br/>
  </div>
  <div>
    维度均分计算方法：
    <%= select_method(f, "dimen_avg", "avg")%>
    加权分值：
    <input type="text" name="" value="<%=0 or @test.survey_count_method.add_num%>" size="5"/>
    <br/><br/>
  </div>

    <%= f.submit "保存" %>
  <% end %>
</div>